package com.mlt.back.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {
    public static String getMD5(String pwd){
        try {
            MessageDigest digest=MessageDigest.getInstance("MD5");
            byte[] pwdData = digest.digest(pwd.getBytes());
            StringBuffer password=new StringBuffer();
            for (byte b : pwdData){
                String s=Integer.toHexString(b& 0XFF);
                password.append(s);
            }
            return password.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return null;
    }
}
